package com.digitalchina.lxnsy.activity.old;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.base.BaseActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.activity
 * 创建人：郑皓
 * 创建时间：2017/6/26 18:01
 * 修改备注：
 * ================================================
 */
public class ExpertCooperationActivity extends BaseActivity {


    @Bind(R.id.cooperation_tv_wechat)
    TextView cooperationTvWechat;
    @Bind(R.id.cooperation_layout_wechat)
    LinearLayout cooperationLayoutWechat;
    @Bind(R.id.cooperation_tv_tel_one)
    TextView cooperationTvTelOne;
    @Bind(R.id.cooperation_layout_tel_one)
    LinearLayout cooperationLayoutTelOne;
    @Bind(R.id.cooperation_tv_tel_two)
    TextView cooperationTvTelTwo;
    @Bind(R.id.cooperation_layout_tel_two)
    LinearLayout cooperationLayoutTelTwo;

    @Override
    public void setLayout() {
        setContentLayout(R.layout.activity_expert_cooperation);
        setTitle("专家注册");
        setRightText("个人注册");
    }

    @Override
    public void initMember() {

    }

    @Override
    public void addListener() {

    }

    @Override
    public void setHandler() {

    }

    @Override
    public void callBack(Object object) {

    }

    @Override
    public void rightOnClick() {
        finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.cooperation_layout_wechat, R.id.cooperation_layout_tel_one, R.id.cooperation_layout_tel_two})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.cooperation_layout_wechat:
                ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                // 将文本内容放到系统剪贴板里。
                cm.setText(cooperationTvWechat.getText());
                showToast("微信号已复制到剪贴板！");
                break;
            case R.id.cooperation_layout_tel_one:
                call(cooperationTvTelOne.getText().toString());
                break;
            case R.id.cooperation_layout_tel_two:
                call(cooperationTvTelTwo.getText().toString());
                break;
        }
    }

    /**
     * 调用拨号界面
     *
     * @param phone 电话号码
     */
    private void call(String phone) {
        Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
}
